<?php

namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class News extends Model
{
    //指定表
    protected $table= 'news';

    //指定主键
    protected $primaryKey = 'id';

    //指定允许批量赋值的字段 （例如: create）
    protected $fillable = [];

    //指定不允许批量赋值的字段
    protected $guarded = [];

   //自动维护时间戳
    public $timestamps = true;

    public function userInfo()
    {
        return $this->hasOne('App\Models\User', 'uid', 'username');
    }

}
